﻿//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Core.h".
//-------------------------------------------------------------------

#ifdef __UX_STL_UNIT_TEST__

#include "../ux_components.h"


using namespace UX_STL;
using namespace UXPhysics;


void BallisticsTest()
{
	/*using namespace Ballistics;

	TShell		s_shell;
	TAtmosphere	s_atm;
	fvec3		v_delta;
	fvec3		v_wind;
	fvec3		v_dir( 1.f, 0.f, 0.f );
	float		f_height = 0.f;
	float		f_time	 = 0.53f;
	float		f_barrel = 0.59f; //0.415f;
	float		f_dt	 = 1.f / 60.f;

	DefaultShell::Init();
	DefaultShell::DefAtmosphere( s_atm );
	DefaultShell::Get( DefaultShell::S_545_39_PS, s_shell );
	
	Utils::ZeroToDist( s_shell, f_barrel, s_atm, 300.f, v_dir );
	
	{
		float	f_vel;
		Utils::Simulate( s_shell, f_barrel, s_atm, 50.f, f_time, f_height, f_vel );
	}

	TBullet	s_bullet( s_shell, v_dir, f_barrel );

	/*
	const uint	c = uint( f_time / f_dt + 0.5f );
	dvec3		delta;

	for (uint i = 0; i < c; ++i) {
		fvec3	d;
		s_bullet.Update( s_atm, f_dt, d );
		delta += d.To<dvec3>();
	}

	v_delta = delta.To<fvec3>();
	v_delta.z *= 2.8f;
	/*
	s_bullet.Update( s_atm, f_time, v_delta );
	v_delta.z *= 2.8f;
	//v_delta.z += Utils::HeightCorrection( 4.f / 1000.f, 300.f, 50.f );
	//*

	WARNING( ( string("\ndist: ") << v_delta.ToStringFull() << "\nvel: " << s_bullet.Velocity() ).cstr() );*/
}


#include "../../stl_core/ux_stl_core_lib.h"

#ifdef PLATFORM_WINDOWS
using namespace winapi;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#endif
{
	BallisticsTest();
	return 0;
}

#endif	__UX_STL_UNIT_TEST__